import Vue from "vue";
import App from "./App.vue";
import { bootstrap } from "cl-admin";
import "./plugins/element";
import "@/utils/socket";
import "@/utils/codemirror";
import "@/assets/css/icon-font.css";
import "./plugins/amap";
import "./registerServiceWorker";
import { appEnv, isProd } from "@/config/env";
import IpcRenderer from "@/utils/ipcRenderer";
const Vant = require("vant");
import "vant/lib/index.css";
import TOOL from "@/utils/deepClone";

// 将其挂载到 Vue 原型上
Vue.prototype.$TOOL = TOOL;

Vue.use(Vant);
// 路由
import router from "@/router";

// 缓存
import store from "@/store";

// global
import global from "@/utils/global";

import mixins from "@/mixins";

//lodash
import _ from "lodash";

Vue.prototype._ = _;
Vue.use(global);

// 全局注入IPC通信
Vue.use(IpcRenderer);

Vue.mixin(mixins);
// 阻止显示生产模式的消息
Vue.config.productionTip = false;

// 生产环境中控制台不打印普通信息，以免造成内存泄漏
if (appEnv == "prod" && isProd) {
	if (console) {
		console.log = () => {};
		console.info = () => {};
	}
}

// 配置
bootstrap()
	.then(() => {
		store.dispatch("appLoad");
		new Vue({
			router,
			store,
			render: h => h(App)
		}).$mount("#app");
		console.log("ADMIN 启动成功");
	})
	.catch(err => {
		console.error("ADMIN 启动失败", err);
	});
